package com.project.controller;


import com.project.bean.DisasterPrevention.EventBean;
import com.project.bean.ExpertConsultation.ConsultBean;
import com.project.service.IConsultService;
import com.project.service.IEventService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("consult")
public class ConsultController {

    @Resource
    private IConsultService consultService;

    @Resource
    private IEventService eventService;

    @RequestMapping("findConsultEvent")
    public List<EventBean> findConsultEvent(String eventStage) {


        List<EventBean> list = consultService.findConsultEvent(eventStage);


        return list;

    }

    @RequestMapping("findEvent")
    public EventBean findEvent(int eventId) {

        EventBean eventBean = consultService.findEvent(eventId);

        return eventBean;

    }

    @RequestMapping("addConsult")
    public String addConsult(ConsultBean consultBean) {
        if (consultBean != null) {
            consultService.addConsult(consultBean);
        }


        return "yes";
    }

    @RequestMapping("updateConsult")
    public String updateConsult(int eventId,String consultResult) {

        consultService.updateConsult(eventId, consultResult);

        return "ok";

    }


    @RequestMapping("updateEventAdvice")

    public String updateEventAdvice(int eventId, String eventAdvice) {

        eventService.updateEventAdvice(eventId, eventAdvice);

        return "ok";

    }





}
